package com.example.keli.ui.worldwall;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.example.keli.R;
import com.example.keli.base.BaseActivity;
import com.example.keli.ui.my.adapter.VoteDetailAdapter;
import com.example.keli.ui.my.model.VoteReceiveBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class CommentListActivity extends BaseActivity {


    @BindView(R.id.recycler_commentlist)
    RecyclerView mRecycler;
    @BindView(R.id.toolbar_subtitle)
    TextView mToolbarSubtitle;

    private List<CommentListBean> mDataList;
    private CommentListAdapter mAdapter;

    @Override
    protected int layoutId() {
        return R.layout.activity_commentlist;
    }

    @Override
    protected void bindData() {
        abTitle.setText("动态消息列表");
        mToolbarSubtitle.setText("清空全部");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        mDataList = new ArrayList<>();
        mAdapter = new CommentListAdapter(mDataList, this);

        for (int i = 0; i < 20; i++) {
            CommentListBean listBean = new CommentListBean();
            listBean.setAvater("https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1559720563&di=a4bdcbaf7c45f162d2cb3ee0fa4a57f6&src=http://img3.duitang.com/uploads/item/201502/20/20150220235727_MLT5j.jpeg");
            listBean.setUsername("sdsa");
            listBean.setContent("是的骄傲是否就哦盎司附近阿三");
            listBean.setDate("一分钟前");
            listBean.setImage("");
            mDataList.add(listBean);
        }
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecycler.setLayoutManager(linearLayoutManager);
        mRecycler.setAdapter(mAdapter);
    }

    @Override
    protected void bindListener() {
        super.bindListener();
        mToolbarSubtitle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDataList.clear();
            }
        });
    }
}
